package com.xyre.client;

import android.app.Application;

import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
import com.xyre.client.config.ConfigFactory;
import com.xyre.client.config.IConfig;
import com.xyre.client.framework.util.Environment;

/**
 * 程序主入口
 *
 * @author 741425192@qq.com 2016年02月29日
 */
public class MainApplication extends Application {

    private static final String TAG = MainApplication.class.getSimpleName();
    private static MainApplication instance;
    private IConfig config;


    @Override
    public void onCreate() {
        super.onCreate();

        instance = this;

        config = ConfigFactory.newInstance();

        //初始化Environment实例
        Environment environment = Environment.getInstance().init(this);

        //注册未捕获异常处理器
//        DebugLog.registerUncaughtExceptionHandler(this);

        // 注册微信SDK
        registWeixin();

    }

    // 注册微信SDK
    private void registWeixin() {

        IWXAPI wxapi = WXAPIFactory.createWXAPI(this, "appid", true);
        wxapi.registerApp("appid");
    }


    public static MainApplication getInstance() {
        return instance;
    }

    public IConfig getConfig() {
        return config;
    }
}
